草庐IT

windows - 将 BSTR 转换为 wstring

全部标签

javascript - electron 的 remote.getGlobal() 在 window.location.replace() 之后返回 "undefined"

我一直在摆弄Electron的远程模块。在我的主进程中,我创建了这个变量:global.storage={};我的渲染器进程是用一个名为startup.html的文件初始化的。win.loadURL('file://'+__dirname+'/startup.html')在那里,我包含了一个包含以下函数的javascript文件:functionenterMain(value){remote.getGlobal('storage').exmpl=value;window.location.replace('./general.html');}我传递的值是“hello”,当调用...co

javascript - 如何修改/重新转换 JSON 数组结构

[{"id":"15","heading":"Post1","content":"Post1Content","date":"2016-11-0908:51:37"},{"id":"16","heading":"Post2","content":"Post2Content","date":"2016-11-0908:52:09"},{"id":"17","heading":"Post3","content":"Post3Content","date":"2015-06-0908:52:09"}]我有上面的JSON数组。我正在尝试将其转换为JSON对象作为2016NovPost1Post

javascript - 从 Window.location.hash 创建数组

我正在尝试从window.location.hash变量创建数组,但我失败了。我的代码是:$.each(window.location.hash.replace("#","").split("&"),function(i,value){value=value.split("=");varmy_item={value[0]:value[1]};form_data[i]=my_item;});console.log(form_data);谢谢。 最佳答案 试一试:varhash=window.location.hash.slice(1)

javascript - 为什么 window.onload 有效而 document.onload 无效?

谁能告诉我为什么以下页面在加载时不会触发警报?如果我使用window.onload而不是document.onload它会起作用。为什么会有这种差异?document.onload=function(){alert('Test');} 最佳答案 最简单的答案是它不是那样设计的。浏览器在“endofthedocumentloadingprocess”处执行附加到window.onload的函数。它不会尝试执行附加到document.onload的函数。您可以将函数分配给document.onload,但浏览器不会对其执行任何特殊操作。

javascript - 延迟后如何在 window.onload 中加载 javascript 函数

我有几个函数应该在onload事件延迟后触发。它在chrome中运行良好,但在Firefox中运行不正常。functionfoo(){//javascriptcode}window.onload=setTimeout(foo,delay);functionbar(){//javascriptcode}window.onload=setTimeout(bar,delay);如果我删除延迟,“bar”会在Firefox中调用,而“foo”和“bar”会在chrome中调用。这可能是什么问题? 最佳答案 我很惊讶这两个函数在任何浏览器中都

javascript - 如何将美国日期格式转换为欧洲日期格式

来自:5/19/2011至:2011-05-19我需要它在发现它不可能像5/40/2011等那样真实时引发错误。是否有任何库可以做得很好? 最佳答案 也许这不是最佳解决方案,但您可以尝试以下简单方法:varfrom="5/19/2011";vartemp=from.split("/");varto=temp[2]+"-"+temp[0]+"-"+temp[1]; 关于javascript-如何将美国日期格式转换为欧洲日期格式,我们在StackOverflow上找到一个类似的问题:

javascript - javascript 中的 webkit 转换语法?

我在这里寻找webkitTransition对象引用functionspawnAnimation(what){//setsthemovingelementvarmoveingEl=document.getElementById(what);//givestemptransitionpropertymoveingEl.style.WebkitTransition="left2s";//moveingEl.style.webkitTransition="top500ms";varcLeft=moveingEl.style.leftvarcleft=Number(cLeft.slice(0,

javascript - JSON Scraping - 通过 Javascript 将军事时间转换为标准时间

我正在从url中抓取JSON数据。时间是军用时间,我想知道在客户端检索后是否有办法将其转换为标准时间。这是JSON:[{SaturdayClose:"21:00",SaturdayOpen:"10:00",SundayClose:"12:00",SundayOpen:"18:00",WeekdayClose:"21:00",WeekdayOpen:"10:00"}]这是我的index.html:Sun:${SundayOpen}a-${SundayClose}pMon-Sat:${SaturdayOpen}a${SaturdayClose}p这会返回这种类型的丑陋:周日:上午18:00

javascript - 从 iFrame/Window 访问 JavaScript 中的父对象

如何在子窗口中访问定义在父窗口中的全局对象或数组。varevents_data;functionfunction_to_fill_events_data(){...}当我在迷你文档中时,我希望能够访问javascript函数中的events_data变量。 最佳答案 选项1您的标题提到了一个子窗口。如果你有一个子窗口,而不是一个iframe,使用这个:window.opener.events_data查看window.openeronMDN.选项2您的代码表明您使用的是iframe。在iframe中,只需使用parent:paren

Javascript 将字符串转换为函数名

这个问题在这里已经有了答案:关闭10年前。PossibleDuplicate:CallaJavaScriptfunctionnameusingastring?javascriptstringtovariable我有这个代码:varFunctionify=function(){return{init:function(el,t){varels=document.getElementsByClassName(el);varelsL=els.length;while(elsL--){//els[elsL].onclick=els[elsL].getAttribute(t);els[elsL]